package com.jxaummd.mushroom.main.common.presenter;

import com.jxaummd.mushroom.R;
import com.jxaummd.mushroom.core.base.presenter.BasePresenter;
import com.jxaummd.mushroom.core.util.tool.storage.UniversityPreference;
import com.jxaummd.mushroom.main.common.contract.LaunchScrollContract;

import java.util.ArrayList;
import java.util.List;

public class LaunchScrollPresenter extends BasePresenter<LaunchScrollContract.View>
        implements  LaunchScrollContract.Presenter{

    private List<Integer> mList = new ArrayList<>();

    public LaunchScrollPresenter(LaunchScrollContract.View view) {
        super(view);
    }


    @Override
    public void start() {
        mList.add(R.mipmap.ic_launcher);
        mList.add(R.mipmap.ic_launcher);
        mList.add(R.mipmap.ic_launcher);
        getView().initView(mList);
    }

    /**
     *被点击
     * @param position
     */
    @Override
    public void clickItem(int position) {
        if(position==(mList.size()-1)){
            getView().finishScroll();
            addScroll();
        }
    }


    public void addScroll(){
        UniversityPreference.setAppFlag(LaunchPresenter.ScrollLunacherTag.HAS_FIRST_LUNCHER_APP.name(),true);
    }
}
